//
//  NavigationTitleView.m
//  YZMicroStock
//
//  Created by apple on 2017/11/29.
//  Copyright © 2017年 cqjr. All rights reserved.
//

#import "NavigationTitleView.h"

@interface NavigationTitleView ()

@property (weak, nonatomic) IBOutlet UILabel *labelTitle;

@property (weak, nonatomic) IBOutlet UIImageView *imageViewIndicator;

@end

@implementation NavigationTitleView{
    BOOL isSelected;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)awakeFromNib{
    [super awakeFromNib];
    self.backgroundColor = [YZMAppStyle colorForMain];
    self.labelTitle.textColor = [YZMAppStyle colorForWhite];
    self.imageViewIndicator.image = [UIImage imageNamed:@"white_arrow_down"];
}

- (void)setTitle:(NSString *)title{
    self.labelTitle.text = title;
}

- (IBAction)clickedBtn:(id)sender {
    isSelected = !isSelected;
    self.imageViewIndicator.image = isSelected?[UIImage imageNamed:@"white_arrow_up"]:[UIImage imageNamed:@"white_arrow_down"];
    if (self.delegate && [self.delegate respondsToSelector:@selector(pullListWith:)]) {
       PullListType type =  isSelected?PullListTypeDown:PullListTypeUp;
        [self.delegate pullListWith:type];
    }
}

- (void)showUp{
    self.imageViewIndicator.image = [UIImage imageNamed:@"white_arrow_up"];
}

- (void)showDown{
    isSelected = NO;
    self.imageViewIndicator.image = [UIImage imageNamed:@"white_arrow_down"];
}

@end
